/*
 * BangoPoster.cpp
 *
 *  Created on: 27 Dec 2012
 */

#include "BangoPoster.h"

BangoPoster::BangoPoster(QObject *parent) : QObject(parent)
{

}
BangoPoster::BangoPoster(BangoLogger *logger, bool notCurrentProfile, bool closeDatabase)
{
	_bangoLogger = logger;
	_notCurrentProfile = notCurrentProfile;
	_closeDatabase = closeDatabase;
}

BangoPoster::~BangoPoster()
{

}

void BangoPoster::PostEvents()
{
	qDebug() << __PRETTY_FUNCTION__;
	_bangoLogger->PostEvents(_notCurrentProfile, _closeDatabase);
}

void BangoPoster::Post()
{
	if(_bangoLogger->PostDelayed()) {
		int time = (_bangoLogger->SessionResumePeriod() * 1000) + BangoConstants::GetInstance()->POSTDELAY_SESSIONEND;
		QTimer::singleShot(time, this, SLOT(PostEvents()));
	}
	else {
		PostEvents();
	}

}



